package chp03;

public class Test9 {
    public static void main(String[] args) {
        //随机数
        double ran = Math.random();
        System.out.println(ran);

        //转为0-9的整数随机数
        int num1 = (int)(ran*10);
        System.out.println(num1);

        //转为1-10的整数随机数
        int num2 = (int)(ran*10)+1;
        System.out.println(num2);

        //转为1500-2000的整数随机数
        int min = 1500;
        int max = 2000;
        int num3 = (int)(ran*(max-min + 1)) + min;
        System.out.println(num3);
    }
}
